#define max1 50
#define infinity 30000
#define TRUE 1
#define FALSE 0
void dijkstra(int s, int t, int *shortest, int path[])
{
	int i, k, distn_i, ver_i, min, new_distn;
	int set[max1];
   int L[max1];

	for(i = 0; i < VerNum; i++)
	{
		set[i] = FALSE;
		L[i] = infinity;
	}
	set[s] = TRUE;
	L[s] = 0;
	ver_i = s;
	while(ver_i != t)
	{
		min = infinity;
		distn_i = L[ver_i];
		for(i = 0; i < VerNum; i++)
			if(set[i] == FALSE)
			{
				new_distn = distn_i + weight[ver_i][i];
				if(new_distn < L[i])
				{
					L[i] = new_distn;
					path[i] = ver_i;
				}
				if(L[i] < min)
				{
					min = L[i];
					k = i;
				}
			}
		ver_i = k;
		set[ver_i] = TRUE;
	}
	*shortest = L[t];
}
